#ifndef __CACHE_H__
#define __CACHE_H__

#include "common.h"

#define BLOCK_SIZE 64
#define STO_SIZE_L1 64 * 1024
#define STO_SIZE_L2 4 * 1024 * 1024

#define EIGHT_WAY  8
#define SIXTEEN_WAY  16

struct Cache{
	bool valid;
	int tag;
	uint8_t data[BLOCK_SIZE];
}cache[STO_SIZE_L1/BLOCK_SIZE];

struct Secondary_Cache{
	bool valid, dirty;
	int tag;
	uint8_t data[BLOCK_SIZE];
}cache2[STO_SIZE_L2/BLOCK_SIZE];

int is_mmio(hwaddr_t);
uint32_t mmio_read(hwaddr_t, size_t, int);
void mmio_write(hwaddr_t, size_t, uint32_t, int);

void init_cache();
uint32_t cache_read_l1(hwaddr_t);
void cache_write_l1(hwaddr_t, size_t, uint32_t);

uint32_t cache_read_l2(hwaddr_t);
void cache_write_l2(hwaddr_t, size_t, uint32_t);

#endif